OPT_RELEASE?=-O2
OPT_DEBUG?=-g -ggdb

CC=gcc
STD=-std=gnu99 -pedantic -fdiagnostics-color=always
WARN=-Wall -W
OPT=$(OPT_RELEASE)

ifeq ($(build_debug),1)
	OPT=${OPT_DEBUG}
endif

CFLAGS=-D_GNU_SOURCES -DUSE_JEMALLOC -I../include
LDFLAGS=
LIBS=-lpthread
AR=ar crus
RM=rm -f

#===================================================
.PHONY: lib

EZ_CUTIL_OBJS = ez_util.o ez_malloc.o ez_log.o ez_hash.o ez_daemon.o ez_net.o ez_event.o ez_min_heap.o
EZ_CUTIL_LIB = libez_c.a

lib: ${EZ_CUTIL_OBJS}
	${AR} ${EZ_CUTIL_LIB} ${EZ_CUTIL_OBJS} 

clean:
	${RM} ${EZ_CUTIL_LIB} ${EZ_CUTIL_OBJS} 

dep:
	gcc ${CFLAGS} -MM *.c > Makefile.dep
#===================================================
%.o: %.c
	${CC} ${STD} ${WARN} ${CFLAGS} ${OPT} -c $< -o $@

#===================================================
# DO NOT EDIT gcc -MM *.c > Makefile.dep
include Makefile.dep
